package com.vitalfit.enums;

import lombok.Getter;

@Getter
public enum OrderStateEnum {
    CANCELLED("已取消"),
    COMPLETED("已完成"),
    CONFIRMED("已确认"),
    DELETED("已删除"),
    EXECUTED("已生效"),
    PENDING("待确认"),
    RESCHEDULED("已改期");

    private final String description;

    OrderStateEnum(String description) {
        this.description = description;
    }

    public static OrderStateEnum getOrderStateByDesc(String description) {
        for (OrderStateEnum orderStateEnum: OrderStateEnum.values()) {
            if (orderStateEnum.getDescription().equals(description)) {
                return orderStateEnum;
            }
        }
        throw new IllegalArgumentException("No matching constant for orderState " + description);
    }


}
